home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tk8.0 / mac / tkMacProlog.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-15  |  1.5 KB  |  62 lines  |  [TEXT/CWIE]

  1. /* 
  2.  * tkMacProlog.c --
  3.  *
  4.  *    Implements a method on the Macintosh to get the prolog
  5.  *    from the resource fork of our application (or the shared
  6.  *    library).
  7.  *
  8.  * Copyright (c) 1996-1997 Sun Microsystems, Inc.
  9.  *
  10.  * See the file "license.terms" for information on usage and redistribution
  11.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12.  *
  13.  * SCCS: @(#) tkMacProlog.c 1.6 97/05/21 10:01:07
  14.  */
  15.  
  16. #include "tkInt.h"
  17. #include "tclMacInt.h"
  18. #include <Resources.h>
  19.  
  20. /*
  21.  *--------------------------------------------------------------
  22.  *
  23.  * TkGetNativeProlog --
  24.  *
  25.  *    Locate and load the postscript prolog from the resource
  26.  *    fork of the application.  If it can't be found then we
  27.  *    will try looking for the file in the system folder.
  28.  *
  29.  * Results:
  30.  *    A standard Tcl Result.  If everything is OK the prolog
  31.  *    will be located in the result string of the interpreter.
  32.  *
  33.  * Side effects:
  34.  *    None.
  35.  *
  36.  *--------------------------------------------------------------
  37.  */
  38.  
  39. int
  40. TkGetNativeProlog(
  41.     Tcl_Interp *interp)        /* Places the prolog in the result. */
  42. {
  43.     Handle resource;
  44.     char *stringPtr;
  45.     int releaseIt;
  46.     
  47.  
  48.     resource = Tcl_MacFindResource(interp, 'TEXT', "prolog", -1,
  49.         NULL, &releaseIt);
  50.                 
  51.     if (resource != NULL) {
  52.     stringPtr = Tcl_MacConvertTextResource(resource);
  53.     Tcl_SetResult(interp, stringPtr, TCL_DYNAMIC);
  54.         if (releaseIt) {            
  55.             ReleaseResource(resource);
  56.         }
  57.         return TCL_OK;
  58.     } else {
  59.     return TkGetProlog(interp);
  60.     }
  61. }
  62.